function [allev] = spike_shape()
% get spikes from traces using template matching - this is used to get
% spikes from an artifact ridden trace.
% 8/2/04 P. Manis
%

global VOLTAGE DFILE

disp 'hi there'
samplerate =  (DFILE.rate(1)*DFILE.nr_channel(1)/1000);
rise=0.5;
decay=.3;
threshold=2;
sign=1;
dispflag = 1;
lpfilter=10000;
template_type=2;

vmean=[];
allev={};
for k = 1:size(VOLTAGE,1)
    vmean(k) = mean(mean(VOLTAGE(k,1:10)));
    [evn, isamp, icoff, crit] = ClementsBekkers(VOLTAGE(k,:)-vmean(k), samplerate, rise, decay, threshold, sign, dispflag, lpfilter, template_type);
    allev{k} = evn; % store result
end;

return;

